{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9f1512cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>no</th>\n",
       "      <th>name</th>\n",
       "      <th>totalprice</th>\n",
       "      <th>price</th>\n",
       "      <th>floor</th>\n",
       "      <th>level</th>\n",
       "      <th>size</th>\n",
       "      <th>year</th>\n",
       "      <th>line</th>\n",
       "      <th>walktime</th>\n",
       "      <th>...</th>\n",
       "      <th>l3wt</th>\n",
       "      <th>l12wt</th>\n",
       "      <th>l1wt</th>\n",
       "      <th>l10a</th>\n",
       "      <th>l15a</th>\n",
       "      <th>l9a</th>\n",
       "      <th>l4a</th>\n",
       "      <th>l3a</th>\n",
       "      <th>l12a</th>\n",
       "      <th>l1a</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>古北首席</td>\n",
       "      <td>570</td>\n",
       "      <td>116876</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>48.77</td>\n",
       "      <td>24</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>...</td>\n",
       "      <td>25</td>\n",
       "      <td>33</td>\n",
       "      <td>41</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>古北首席</td>\n",
       "      <td>530</td>\n",
       "      <td>108674</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>48.77</td>\n",
       "      <td>24</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>...</td>\n",
       "      <td>25</td>\n",
       "      <td>33</td>\n",
       "      <td>41</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>虹桥大仕馆</td>\n",
       "      <td>1600</td>\n",
       "      <td>107766</td>\n",
       "      <td>18</td>\n",
       "      <td>15</td>\n",
       "      <td>148.47</td>\n",
       "      <td>22</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>25</td>\n",
       "      <td>39</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>虹桥大仕馆</td>\n",
       "      <td>1530</td>\n",
       "      <td>103652</td>\n",
       "      <td>18</td>\n",
       "      <td>3</td>\n",
       "      <td>147.61</td>\n",
       "      <td>22</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>25</td>\n",
       "      <td>39</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>虹桥大仕馆</td>\n",
       "      <td>1550</td>\n",
       "      <td>104638</td>\n",
       "      <td>18</td>\n",
       "      <td>9</td>\n",
       "      <td>148.13</td>\n",
       "      <td>22</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>25</td>\n",
       "      <td>39</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td>362</td>\n",
       "      <td>长春新苑</td>\n",
       "      <td>1090</td>\n",
       "      <td>111214</td>\n",
       "      <td>17</td>\n",
       "      <td>3</td>\n",
       "      <td>98.01</td>\n",
       "      <td>14</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>362</th>\n",
       "      <td>363</td>\n",
       "      <td>长春新苑</td>\n",
       "      <td>595</td>\n",
       "      <td>82285</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>72.31</td>\n",
       "      <td>27</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>363</th>\n",
       "      <td>364</td>\n",
       "      <td>领尚国际酒店公寓</td>\n",
       "      <td>276</td>\n",
       "      <td>55702</td>\n",
       "      <td>18</td>\n",
       "      <td>9</td>\n",
       "      <td>49.55</td>\n",
       "      <td>20</td>\n",
       "      <td>3</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>23</td>\n",
       "      <td>43</td>\n",
       "      <td>53</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>364</th>\n",
       "      <td>365</td>\n",
       "      <td>领尚国际酒店公寓</td>\n",
       "      <td>280</td>\n",
       "      <td>54055</td>\n",
       "      <td>18</td>\n",
       "      <td>15</td>\n",
       "      <td>51.80</td>\n",
       "      <td>20</td>\n",
       "      <td>3</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>23</td>\n",
       "      <td>43</td>\n",
       "      <td>53</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>365</th>\n",
       "      <td>366</td>\n",
       "      <td>领尚国际酒店公寓</td>\n",
       "      <td>500</td>\n",
       "      <td>57931</td>\n",
       "      <td>18</td>\n",
       "      <td>9</td>\n",
       "      <td>86.31</td>\n",
       "      <td>20</td>\n",
       "      <td>3</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>23</td>\n",
       "      <td>43</td>\n",
       "      <td>53</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>366 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      no      name  totalprice   price  floor  level    size  year  line  \\\n",
       "0      1      古北首席         570  116876      6      1   48.77    24     5   \n",
       "1      2      古北首席         530  108674      6      1   48.77    24     5   \n",
       "2      3     虹桥大仕馆        1600  107766     18     15  148.47    22     5   \n",
       "3      4     虹桥大仕馆        1530  103652     18      3  147.61    22     5   \n",
       "4      5     虹桥大仕馆        1550  104638     18      9  148.13    22     5   \n",
       "..   ...       ...         ...     ...    ...    ...     ...   ...   ...   \n",
       "361  362      长春新苑        1090  111214     17      3   98.01    14     5   \n",
       "362  363      长春新苑         595   82285      6      5   72.31    27     5   \n",
       "363  364  领尚国际酒店公寓         276   55702     18      9   49.55    20     3   \n",
       "364  365  领尚国际酒店公寓         280   54055     18     15   51.80    20     3   \n",
       "365  366  领尚国际酒店公寓         500   57931     18      9   86.31    20     3   \n",
       "\n",
       "     walktime  ...  l3wt  l12wt  l1wt  l10a  l15a  l9a  l4a  l3a  l12a  l1a  \n",
       "0           7  ...    25     33    41     1     1    1    1    1     0    0  \n",
       "1           7  ...    25     33    41     1     1    1    1    1     0    0  \n",
       "2          10  ...    25     39    49     1     1    1    1    1     0    0  \n",
       "3          10  ...    25     39    49     1     1    1    1    1     0    0  \n",
       "4          10  ...    25     39    49     1     1    1    1    1     0    0  \n",
       "..        ...  ...   ...    ...   ...   ...   ...  ...  ...  ...   ...  ...  \n",
       "361         6  ...    19     19    32     0     1    1    1    1     1    0  \n",
       "362         6  ...    19     19    32     0     1    1    1    1     1    0  \n",
       "363        10  ...    23     43    53     1     1    0    0    1     0    0  \n",
       "364        10  ...    23     43    53     1     1    0    0    1     0    0  \n",
       "365        10  ...    23     43    53     1     1    0    0    1     0    0  \n",
       "\n",
       "[366 rows x 24 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "house = pd.read_csv(\"house.csv\",encoding = \"gbk\")\n",
    "house"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6416a84e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(366, 24)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "house.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b53eb374",
   "metadata": {},
   "source": [
    "## 平方单价测试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b1f5bfac",
   "metadata": {},
   "outputs": [],
   "source": [
    "h0:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab47fbf3",
   "metadata": {},
   "outputs": [],
   "source": [
    "h1:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "25bd4927",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Predicted</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>589.213786</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Predicted\n",
       "0  589.213786"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入数据\n",
    "import pandas as pd\n",
    "house = pd.read_csv(\"house.csv\",encoding = \"gbk\")\n",
    "\n",
    "#建模\n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.model_selection import cross_val_score\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "X = house[['floor','size','year','line']]\n",
    "y = np.array(house.price)\n",
    "\n",
    "Xtrain,Xtest,ytrain,ytest=train_test_split(X,y,test_size=0.3,random_state=414)\n",
    "\n",
    "lr = LinearRegression()\n",
    "lr.fit(Xtrain,ytrain)#训练\n",
    "\n",
    "#预测\n",
    "x_s = {'floor':[8],'size':[66],'year':[23],'line':[4]}\n",
    "x_s = pd.DataFrame(x_s)\n",
    "\n",
    "pred=lr.predict(x_s)\n",
    "output = pd.DataFrame({'Predicted':pred*x_s['size']/10000})#统一为总价预测，单位：万元\n",
    "output\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "90d7e3a2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>#sk-container-id-1 {color: black;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LinearRegression()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LinearRegression</label><div class=\"sk-toggleable__content\"><pre>LinearRegression()</pre></div></div></div></div></div>"
      ],
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "house = pd.read_csv(\"house.csv\",encoding = \"gbk\")\n",
    "\n",
    "#统一量纲 平方单价单位：十万\n",
    "import numpy as np\n",
    "X = house[['floor','size','year','line']]\n",
    "y = np.array(house.price/100000)\n",
    "\n",
    "#重设模型\n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "Xtrain,Xtest,ytrain,ytest=train_test_split(X,y,test_size=0.3,random_state=414)\n",
    "lr = LinearRegression()\n",
    "lr.fit(Xtrain,ytrain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1470afb8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.0340143024786005"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# MSE均方误差评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "y_pred = lr.predict(Xtrain)\n",
    "MSE_train_1=mean_squared_error(ytrain,y_pred)\n",
    "MSE_train_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ffa73cc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.039016820960380026"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test_pred=lr.predict(Xtest)\n",
    "MSE_test_1=mean_squared_error(ytest,y_test_pred)\n",
    "MSE_test_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "12e071c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.03839262273490525"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#交叉验证-MSE\n",
    "from sklearn.model_selection import cross_val_score\n",
    "lr2 = LinearRegression()\n",
    "MSE_cvs_1=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "MSE_cvs_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8f37cb73",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.1307678685696052"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 交叉验证-MAE\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "MAE_1=mean_absolute_error(ytrain,y_pred)\n",
    "MAE_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "d44ea89b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.1354158097405989"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MAE_cvs_1=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_absolute_error').mean()\n",
    "MAE_cvs_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "47b34b77",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5544249932303594"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#交叉验证-方差\n",
    "from sklearn.metrics import r2_score\n",
    "r2_train_1=r2_score(ytrain,y_pred)\n",
    "r2_train_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8cabf9a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.45033062206091357"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r2_test_1=r2_score(ytest,y_test_pred)\n",
    "r2_test_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3880008d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5544249932303594"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Score_train_1=lr.score(Xtrain,ytrain)\n",
    "Score_train_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b451d0f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.45033062206091357"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Score_test_1=lr.score(Xtest,ytest)\n",
    "Score_test_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "264fdcb6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkkAAAGsCAYAAADJ4TOYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABPwElEQVR4nO3deXxTVf4//learoHutKWU0pVFQEYHK6UgovBBFNCKqKOMC6DoDxFHBFkdlRGLDCrOF0VcEKosojNlU0CHsg2IWgQ0FpECpWUpFihJuqVLzu+Pa2JL0i0kucnN6/l45JGbnJvknVzSvDj33HNVQggBIiIiImrER+4CiIiIiNwRQxIRERGRDQxJRERERDYwJBERERHZwJBEREREZANDEhEREZENDElERERENvjKXYCnMplMOHv2LIKDg6FSqeQuh4iIiFpBCAGDwYBOnTrBx6f5viKGJDudPXsW8fHxcpdBREREdiguLkbnzp2bXYchyU7BwcEApA85JCRE5mqIiIioNfR6PeLj4y2/481hSLKTeRdbSEgIQxIREZGHac1QGQ7cJiIiIrKBIYmIiIjIBoYkIiIiIhsYkoiIiIhsYEgiIiIisoEhiYiIiMgGhiQiIiIiGxiSiIiIiGxgSCIiIiKygSGJiIiIyAavD0larRZpaWkIDw/H9OnTIYSQuyQiIiJyA14dkoxGI0aNGoW+ffsiLy8P+fn5WLFihdxlERERkRvw6hPcbtmyBTqdDm+88QY0Gg1effVVPPXUUxg3bpxsNRn1Rpz/+YJsr+8JrDr7Gp6k8MoTFjbV1tSJDX18gMjIptuJlKa+HqiogEqYrNua6llv6/2A9J3y8QFUAFQ+DW7/fg00vq1S/XHxRubPsuF1S8sNH9vUulaPEYBo4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ARYuAadOAAQOA//1P7sqIiNqsud/vK7nlaUmaEhcXh7i4OJe1EREAtRro0EHa3bZjh3Qfj2wjIi/gNmOSiMiNmccl7d4tXXM8EhF5AYYkcqq27s1teF44IQQuX77s4IqsVVdXo7Kystl1rjzysrq62jL3klcwhySDQbpmSCIiL8CQRI188803uP3221FeXt7senV1ddDpdJbb+/btw7p166zWGzVqFL7++mubz3H58mW88sorlrCRlZWFhx56yNK+detWpKSkoLCw0OqxFy9eRHl5uSWs2Lo0NXs3ACQnJ2PDhg0AgHnz5mHcuHFNrltbW4vu3btjy5Ytlvu+++47tG/fHjqdDu+//74yT0fSkDkkmTEkEZEXYEiiRtLT05GcnIz/+7//g+H3XoN77rkH//nPfyCEwPr16wEAP/zwA+666y7L41577TXL6UyMRiOEELhw4QL27t2Lfv36AZCCVU1NjeUxtbW1ltmqa2pqcN9992HDhg2W8LJw4UI8/PDDSExMtKqzS5cu6NChA6KiotCxY0erS3BwMN58880m36dGo0FoaCgAaQJMPz+/JtddvXo1UlJSMHz4cMt9UVFRCA0NRWhoKHJzc/HCCy8097F6voYhKTLSOjQRESmQRw3c9mRCAC3s0XEajab1p9hSqVRYsmQJHn/8cRw4cACDBw+Gr68vhBBQqVQYM2YM6urq4O/vbzn1SFFREbRaLdasWYOSkhKMGjUK58+fh16vh0qlQp8+fQBIu9IGDBiANWvWAJCCxpdffon3338fvr6+SElJwZdffon09HRs3rwZZ86cadR701BFRUWz72Po0KGNTi9z8ODBRr1UTZ27zWzDhg1ISUlBRUUFXn31VWzcuBEbN26EVqvFnDlz4OfnZ9mV+Morr2D//v1Yvnw5xo8f37oP2tM0DEW9e/OcbUTkFRiSXKSyEmjfXp7XLi8H2rVreb2amhrU1NTA19cX7777riUENZwp+8pzsgHAokWLsGDBAvj5+aFfv35YsWIFbrnlFmRkZGDRokXIyMiweszRo0fRo0cPREZGAkCTvT6dO3dGeXk5Zs+ejb///e+Nah04cCBGjx6NZ5991mo2b6PRiHYN3rTJZMLPP/9sCTa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tY4zf/58MXHixGbX8bRta+vHpbq6WiQmJoonnnhCFBQUiDvuuEMsX768xedy9+08ZMgQsXjx4kbv1Z7vrxDuv51tbVch2v7dFcL9t6sQtrftlVrz/RXCvbdtU6He3b+zDElksXTpUtGzZ89m1/n3v/8toqKiRFxcnNBoNOL+++8Xly5dclGFV6e2tlYEBwcLg8HQ6se8+eabonv37pb/2axfv16MHTvWWSU6RVVVlYiOjm7yD7CZp21bWz8uOTk5Ijw8XFRUVAghhDh06JAYMGBAi8/l7tvZ3IPQ3A9pa76/Qrj/dra1Xe357grh/ttViJa3bWu/v0K497ZtKtS7+3eWY5IIAFBTU4NFixZh0qRJza7366+/om/fvti2bRvy8vJQWFiI2bNnu6jKq/Pjjz9CCIHrrrsOQUFBGD58OIqKipp9zOHDh3HrrbdaTmJ844034ocffnBFuQ6zevVqpKenIzExsdn1PG3bvvfee3jmmWca3Xf48GGkp6dDo9EAAPr06YP8/PwWn8vdt3NycnKz7a39/gLuv51tbVd7vruA+29XoOVt29rvL+De23bkyJF48sknLbePHj2K1NRU9//OOjx2kUeaPn26+NOf/iRqamra9LidO3eKDh06OKkqx/rkk09Ev379xHfffSdOnDghRo4cKYYPH97sY0aPHi0WLlxouV1eXi5CQkKcXapDpaWliS+//LLNj/OUbYsG/wOfOnWqmDRpUqP2Dh06tPi/aU/Zzmiit8He768Q7rudG75Xe767QnjOdhWi6W1r7/dXCPfdtkajUaSkpIglS5a4/XfW1/GxizzN119/jXfffRf79++Hn59fmx4bFhaGCxcuwGg0uv1U+WPHjsXYsWMtt5csWYLk5GTo9fomzzDt6+vb6H0FBgaisrLS6bU6SkFBAQoKCuw6wsWTtq3ZldsL+GObhYeHt/pxnrSdr+b7C3jGdrbnuwt49nYFru77C7jvtp07dy7at2+PiRMnYu7cuW79neXuNi934sQJjB07FkuXLkXPnj1bXH/MmDHYv3+/5fb333+Pjh07utUXsLXCwsJgMplw7ty5JteJiIhAaWmp5bbBYIC/v78rynOIdevWYeTIka368VTCtr1yew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ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 学习曲线\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.rcParams['axes.unicode_minus'] = False\n",
    "plt.rcParams['font.sans-serif'] = ['Simhei']\n",
    "\n",
    "res_test = []\n",
    "res_train = []\n",
    "\n",
    "for i in range(20):\n",
    "    poly = PolynomialFeatures(degree=i+1).fit(Xtrain,ytrain)\n",
    "    X_train = poly.transform(Xtrain)\n",
    "    X_test = poly.transform(Xtest)\n",
    "    lr1 = LinearRegression().fit(X_train,ytrain)\n",
    "    res_score = lr1.score(X_test,ytest)\n",
    "    res = lr1.score(X_train,ytrain)\n",
    "    res_test.append(res_score)\n",
    "    res_train.append(res)\n",
    "    \n",
    "plt.plot(range(1,21),res_test,color=\"red\",label=\"测试学习曲线\")\n",
    "plt.plot(range(1,21),res_train,color=\"blue\",label=\"训练学习曲线\")\n",
    "plt.ylabel(\"socre\")\n",
    "plt.xlabel(\"degree\")\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "c99924f2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>多项式次数</th>\n",
       "      <th>测试集分数</th>\n",
       "      <th>训练集分数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.450331</td>\n",
       "      <td>0.554425</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>0.774423</td>\n",
       "      <td>0.840929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0.805098</td>\n",
       "      <td>0.888445</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>0.259345</td>\n",
       "      <td>0.921904</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>-4.285438</td>\n",
       "      <td>0.936142</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>-11774.294200</td>\n",
       "      <td>0.982001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>-11324.330363</td>\n",
       "      <td>0.983149</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>-63264.108189</td>\n",
       "      <td>0.982851</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>-36782.609358</td>\n",
       "      <td>0.981683</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>-3256.233268</td>\n",
       "      <td>0.976644</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>11</td>\n",
       "      <td>-118.258888</td>\n",
       "      <td>0.965115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>12</td>\n",
       "      <td>-268.412370</td>\n",
       "      <td>0.934787</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>13</td>\n",
       "      <td>-9.064622</td>\n",
       "      <td>0.917261</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>14</td>\n",
       "      <td>-6.179421</td>\n",
       "      <td>0.896310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>15</td>\n",
       "      <td>-32.522705</td>\n",
       "      <td>0.894660</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>16</td>\n",
       "      <td>-38.501468</td>\n",
       "      <td>0.856162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>17</td>\n",
       "      <td>-24.795483</td>\n",
       "      <td>0.772465</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>18</td>\n",
       "      <td>-13.119479</td>\n",
       "      <td>0.718885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>19</td>\n",
       "      <td>-2.451803</td>\n",
       "      <td>0.673496</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20</td>\n",
       "      <td>-0.465819</td>\n",
       "      <td>0.613381</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    多项式次数         测试集分数     训练集分数\n",
       "0       1      0.450331  0.554425\n",
       "1       2      0.774423  0.840929\n",
       "2       3      0.805098  0.888445\n",
       "3       4      0.259345  0.921904\n",
       "4       5     -4.285438  0.936142\n",
       "5       6 -11774.294200  0.982001\n",
       "6       7 -11324.330363  0.983149\n",
       "7       8 -63264.108189  0.982851\n",
       "8       9 -36782.609358  0.981683\n",
       "9      10  -3256.233268  0.976644\n",
       "10     11   -118.258888  0.965115\n",
       "11     12   -268.412370  0.934787\n",
       "12     13     -9.064622  0.917261\n",
       "13     14     -6.179421  0.896310\n",
       "14     15    -32.522705  0.894660\n",
       "15     16    -38.501468  0.856162\n",
       "16     17    -24.795483  0.772465\n",
       "17     18    -13.119479  0.718885\n",
       "18     19     -2.451803  0.673496\n",
       "19     20     -0.465819  0.613381"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "Res_match = pd.DataFrame({'多项式次数':range(1,21),'测试集分数':res_test,'训练集分数':res_train})\n",
    "Res_match"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "37c0688e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Predicted</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>458.225432</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Predicted\n",
       "0  458.225432"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#重设模型\n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "\n",
    "Xtrain,Xtest,ytrain,ytest=train_test_split(X,y,test_size=0.3,random_state=414)\n",
    "poly = PolynomialFeatures(degree=3).fit(Xtrain,ytrain)\n",
    "X_train = poly.transform(Xtrain)\n",
    "X_test = poly.transform(Xtest)\n",
    "lr1 = LinearRegression().fit(X_train,ytrain)\n",
    "\n",
    "y_test_pred=lr1.predict(X_test)\n",
    "\n",
    "#优化预测\n",
    "x_s = {'floor':[8],'size':[66],'year':[23],'line':[4]}\n",
    "x_s = pd.DataFrame(x_s)\n",
    "\n",
    "X_s = poly.transform(x_s)\n",
    "\n",
    "pred=lr1.predict(X_s)*100000 #恢复量纲，平方单价单位：元\n",
    "output = pd.DataFrame({'Predicted':pred*x_s['size']/10000})#统一为总价预测，单位：万元\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "a8985342",
   "metadata": {},
   "outputs": [],
   "source": [
    "# MSE均方误差评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "y_pred = lr1.predict(X_train)\n",
    "MSE_train_2=mean_squared_error(ytrain,y_pred)\n",
    "\n",
    "y_test_pred=lr1.predict(X_test)\n",
    "MSE_test_2=mean_squared_error(ytest,y_test_pred)\n",
    "\n",
    "#交叉验证-MSE\n",
    "from sklearn.model_selection import cross_val_score\n",
    "lr2 = LinearRegression()\n",
    "MSE_cvs_2=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "\n",
    "# 交叉验证-MAE\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "MAE_2=mean_absolute_error(ytrain,y_pred)\n",
    "\n",
    "MAE_cvs_2=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_absolute_error').mean()\n",
    "\n",
    "#交叉验证-方差\n",
    "from sklearn.metrics import r2_score\n",
    "r2_train_2=r2_score(ytrain,y_pred)\n",
    "\n",
    "r2_test_2=r2_score(ytest,y_test_pred)\n",
    "\n",
    "Score_train_2=lr1.score(X_train,ytrain)\n",
    "\n",
    "Score_test_2=lr1.score(X_test,ytest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "10e2ec09",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 归一化\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "std = StandardScaler()\n",
    "X_train = std.fit_transform(Xtrain)\n",
    "X_test = std.fit_transform(Xtest)\n",
    "lr3 = LinearRegression().fit(X_train,ytrain)\n",
    "\n",
    "y_test_pred=lr3.predict(X_test)\n",
    "\n",
    "# MSE均方误差评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "y_pred = lr3.predict(X_train)\n",
    "MSE_train_3=mean_squared_error(ytrain,y_pred)\n",
    "\n",
    "y_test_pred=lr3.predict(X_test)\n",
    "MSE_test_3=mean_squared_error(ytest,y_test_pred)\n",
    "\n",
    "#交叉验证-MSE\n",
    "from sklearn.model_selection import cross_val_score\n",
    "lr2 = LinearRegression()\n",
    "MSE_cvs_3=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "\n",
    "# 交叉验证-MAE\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "MAE_3=mean_absolute_error(ytrain,y_pred)\n",
    "\n",
    "MAE_cvs_3=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_absolute_error').mean()\n",
    "\n",
    "#交叉验证-方差\n",
    "from sklearn.metrics import r2_score\n",
    "r2_train_3=r2_score(ytrain,y_pred)\n",
    "\n",
    "r2_test_3=r2_score(ytest,y_test_pred)\n",
    "\n",
    "Score_train_3=lr3.score(X_train,ytrain)\n",
    "\n",
    "Score_test_3=lr3.score(X_test,ytest)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "bd9e7e94",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 先归一化后多线性\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "std = StandardScaler()\n",
    "X_train_std = std.fit_transform(Xtrain)\n",
    "X_test_std = std.fit_transform(Xtest)\n",
    "\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "poly = PolynomialFeatures(degree=2).fit(X_train_std,ytrain)\n",
    "X_train = poly.transform(X_train_std)\n",
    "X_test = poly.transform(X_test_std)\n",
    "\n",
    "lr4 = LinearRegression().fit(X_train,ytrain)\n",
    "\n",
    "y_test_pred=lr4.predict(X_test)\n",
    "\n",
    "# MSE均方误差评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "y_pred = lr4.predict(X_train)\n",
    "MSE_train_4=mean_squared_error(ytrain,y_pred)\n",
    "\n",
    "y_test_pred=lr4.predict(X_test)\n",
    "MSE_test_4=mean_squared_error(ytest,y_test_pred)\n",
    "\n",
    "#交叉验证-MSE\n",
    "from sklearn.model_selection import cross_val_score\n",
    "lr2 = LinearRegression()\n",
    "MSE_cvs_4=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "\n",
    "# 交叉验证-MAE\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "MAE_4=mean_absolute_error(ytrain,y_pred)\n",
    "\n",
    "MAE_cvs_4=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_absolute_error').mean()\n",
    "\n",
    "#交叉验证-方差\n",
    "from sklearn.metrics import r2_score\n",
    "r2_train_4=r2_score(ytrain,y_pred)\n",
    "\n",
    "r2_test_4=r2_score(ytest,y_test_pred)\n",
    "\n",
    "Score_train_4=lr4.score(X_train,ytrain)\n",
    "\n",
    "Score_test_4=lr4.score(X_test,ytest)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "ee1c452b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 先多线性后归一化\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "poly = PolynomialFeatures(degree=2).fit(Xtrain,ytrain)\n",
    "X_train = poly.transform(Xtrain)\n",
    "X_test = poly.transform(Xtest)\n",
    "\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "std = StandardScaler()\n",
    "X_train = std.fit_transform(X_train)\n",
    "X_test = std.fit_transform(X_test)\n",
    "\n",
    "lr5 = LinearRegression().fit(X_train,ytrain)\n",
    "\n",
    "y_test_pred=lr4.predict(X_test)\n",
    "\n",
    "# MSE均方误差评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "y_pred = lr5.predict(X_train)\n",
    "MSE_train_5=mean_squared_error(ytrain,y_pred)\n",
    "\n",
    "y_test_pred=lr5.predict(X_test)\n",
    "MSE_test_5=mean_squared_error(ytest,y_test_pred)\n",
    "\n",
    "#交叉验证-MSE\n",
    "from sklearn.model_selection import cross_val_score\n",
    "lr2 = LinearRegression()\n",
    "MSE_cvs_5=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "\n",
    "# 交叉验证-MAE\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "MAE_5=mean_absolute_error(ytrain,y_pred)\n",
    "\n",
    "MAE_cvs_5=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_absolute_error').mean()\n",
    "\n",
    "#交叉验证-方差\n",
    "from sklearn.metrics import r2_score\n",
    "r2_train_5=r2_score(ytrain,y_pred)\n",
    "\n",
    "r2_test_5=r2_score(ytest,y_test_pred)\n",
    "\n",
    "Score_train_5=lr5.score(X_train,ytrain)\n",
    "\n",
    "Score_test_5=lr5.score(X_test,ytest)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "6bb2c590",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>评估项目</th>\n",
       "      <th>优化前</th>\n",
       "      <th>总价最优化</th>\n",
       "      <th>多线性优化后</th>\n",
       "      <th>归一化后</th>\n",
       "      <th>先归一后多线优化</th>\n",
       "      <th>先多线后归一优化</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>MSE_train</td>\n",
       "      <td>0.034014</td>\n",
       "      <td>0.010753</td>\n",
       "      <td>0.008516</td>\n",
       "      <td>0.034014</td>\n",
       "      <td>0.012143</td>\n",
       "      <td>0.012143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>MSE_test</td>\n",
       "      <td>0.039017</td>\n",
       "      <td>0.016343</td>\n",
       "      <td>0.013835</td>\n",
       "      <td>0.039025</td>\n",
       "      <td>0.017999</td>\n",
       "      <td>0.019161</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>MSE_cvs</td>\n",
       "      <td>-0.038393</td>\n",
       "      <td>-0.073624</td>\n",
       "      <td>-0.038393</td>\n",
       "      <td>-0.038393</td>\n",
       "      <td>-0.038393</td>\n",
       "      <td>-0.073624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>MAE</td>\n",
       "      <td>0.130768</td>\n",
       "      <td>0.073262</td>\n",
       "      <td>0.070639</td>\n",
       "      <td>0.130768</td>\n",
       "      <td>0.086325</td>\n",
       "      <td>0.086325</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>MAE_cvs</td>\n",
       "      <td>-0.135416</td>\n",
       "      <td>-0.186796</td>\n",
       "      <td>-0.135416</td>\n",
       "      <td>-0.135416</td>\n",
       "      <td>-0.135416</td>\n",
       "      <td>-0.135416</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>r2_train</td>\n",
       "      <td>0.554425</td>\n",
       "      <td>0.981317</td>\n",
       "      <td>0.888445</td>\n",
       "      <td>0.554425</td>\n",
       "      <td>0.840929</td>\n",
       "      <td>0.840929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>r2_test</td>\n",
       "      <td>0.450331</td>\n",
       "      <td>0.941406</td>\n",
       "      <td>0.805098</td>\n",
       "      <td>0.450214</td>\n",
       "      <td>0.746432</td>\n",
       "      <td>0.730066</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Score_train</td>\n",
       "      <td>0.554425</td>\n",
       "      <td>0.981317</td>\n",
       "      <td>0.888445</td>\n",
       "      <td>0.554425</td>\n",
       "      <td>0.840929</td>\n",
       "      <td>0.840929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Score_test</td>\n",
       "      <td>0.450331</td>\n",
       "      <td>0.941406</td>\n",
       "      <td>0.805098</td>\n",
       "      <td>0.450214</td>\n",
       "      <td>0.746432</td>\n",
       "      <td>0.730066</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          评估项目       优化前     总价最优化    多线性优化后      归一化后  先归一后多线优化  先多线后归一优化\n",
       "0    MSE_train  0.034014  0.010753  0.008516  0.034014  0.012143  0.012143\n",
       "1     MSE_test  0.039017  0.016343  0.013835  0.039025  0.017999  0.019161\n",
       "2      MSE_cvs -0.038393 -0.073624 -0.038393 -0.038393 -0.038393 -0.073624\n",
       "3          MAE  0.130768  0.073262  0.070639  0.130768  0.086325  0.086325\n",
       "4      MAE_cvs -0.135416 -0.186796 -0.135416 -0.135416 -0.135416 -0.135416\n",
       "5     r2_train  0.554425  0.981317  0.888445  0.554425  0.840929  0.840929\n",
       "6      r2_test  0.450331  0.941406  0.805098  0.450214  0.746432  0.730066\n",
       "7  Score_train  0.554425  0.981317  0.888445  0.554425  0.840929  0.840929\n",
       "8   Score_test  0.450331  0.941406  0.805098  0.450214  0.746432  0.730066"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 总价最优模型提取\n",
    "import pandas as pd\n",
    "house = pd.read_csv(\"house.csv\",encoding = \"gbk\")\n",
    "\n",
    "#统一量纲 总价单位：千万\n",
    "import numpy as np\n",
    "X = house[['floor','size','year','line']]\n",
    "y = np.array(house.totalprice/1000)\n",
    "\n",
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "\n",
    "Xtrain,Xtest,ytrain,ytest=train_test_split(X,y,test_size=0.3,random_state=414)\n",
    "\n",
    "poly = PolynomialFeatures(degree=2).fit(Xtrain,ytrain)\n",
    "X_train = poly.transform(Xtrain)\n",
    "X_test = poly.transform(Xtest)\n",
    "lr6 = LinearRegression().fit(X_train,ytrain)\n",
    "\n",
    "y_test_pred=lr6.predict(X_test)\n",
    "\n",
    "# MSE均方误差评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "y_pred = lr6.predict(X_train)\n",
    "MSE_train_6=mean_squared_error(ytrain,y_pred)\n",
    "\n",
    "y_test_pred=lr6.predict(X_test)\n",
    "MSE_test_6=mean_squared_error(ytest,y_test_pred)\n",
    "\n",
    "#交叉验证-MSE\n",
    "from sklearn.model_selection import cross_val_score\n",
    "lr2 = LinearRegression()\n",
    "MSE_cvs_6=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "\n",
    "# 交叉验证-MAE\n",
    "from sklearn.metrics import mean_absolute_error\n",
    "MAE_6=mean_absolute_error(ytrain,y_pred)\n",
    "\n",
    "MAE_cvs_6=cross_val_score(lr2,Xtrain,ytrain,cv=10,scoring='neg_mean_absolute_error').mean()\n",
    "\n",
    "#交叉验证-方差\n",
    "from sklearn.metrics import r2_score\n",
    "r2_train_6=r2_score(ytrain,y_pred)\n",
    "\n",
    "r2_test_6=r2_score(ytest,y_test_pred)\n",
    "\n",
    "Score_train_6=lr6.score(X_train,ytrain)\n",
    "\n",
    "Score_test_6=lr6.score(X_test,ytest)\n",
    "\n",
    "import pandas as pd\n",
    "output = pd.DataFrame({'评估项目':['MSE_train','MSE_test','MSE_cvs','MAE','MAE_cvs','r2_train','r2_test','Score_train','Score_test'],\n",
    "                       '优化前':[MSE_train_1,MSE_test_1,MSE_cvs_1,MAE_1,MAE_cvs_1,r2_train_1,r2_test_1,Score_train_1,Score_test_1],\n",
    "                       '总价最优化':[MSE_train_6,MSE_test_6,MSE_cvs_6,MAE_6,MAE_cvs_6,r2_train_6,r2_test_6,Score_train_6,Score_test_6],\n",
    "                       '多线性优化后':[MSE_train_2,MSE_test_2,MSE_cvs_2,MAE_2,MAE_cvs_2,r2_train_2,r2_test_2,Score_train_2,Score_test_2],\n",
    "                       '归一化后':[MSE_train_3,MSE_test_3,MSE_cvs_3,MAE_3,MAE_cvs_3,r2_train_3,r2_test_3,Score_train_3,Score_test_3],\n",
    "                       '先归一后多线优化':[MSE_train_4,MSE_test_4,MSE_cvs_4,MAE_4,MAE_cvs_4,r2_train_4,r2_test_4,Score_train_4,Score_test_4],\n",
    "                       '先多线后归一优化':[MSE_train_5,MSE_test_5,MSE_cvs_5,MAE_5,MAE_cvs_5,r2_train_5,r2_test_5,Score_train_5,Score_test_5]\n",
    "                      })\n",
    "output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ab3eaea1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('floor', 27.52526554153032),\n",
       " ('size', 2.0171917452381782),\n",
       " ('year', 232.52537774485458),\n",
       " ('line', 1842.0435867268613)]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#训练结果\n",
    "list(zip(X.columns,lr1.coef_[1:]*100000*66/10000))#恢复量纲并换算，平方单价单位：元"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "79b30ae7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>495733.766447</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>floor</td>\n",
       "      <td>0.041705</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>size</td>\n",
       "      <td>0.003056</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>year</td>\n",
       "      <td>0.352311</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>line</td>\n",
       "      <td>2.790975</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>floor^2</td>\n",
       "      <td>0.005104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>floor size</td>\n",
       "      <td>-0.000865</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>floor year</td>\n",
       "      <td>0.001319</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>floor line</td>\n",
       "      <td>-0.035902</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>size^2</td>\n",
       "      <td>0.000023</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>size year</td>\n",
       "      <td>0.000212</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>size line</td>\n",
       "      <td>-0.001352</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>year^2</td>\n",
       "      <td>-0.002009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>year line</td>\n",
       "      <td>-0.121726</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>line^2</td>\n",
       "      <td>-0.103025</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>floor^3</td>\n",
       "      <td>-0.000045</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>floor^2 size</td>\n",
       "      <td>-0.000013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>floor^2 year</td>\n",
       "      <td>-0.000083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>floor^2 line</td>\n",
       "      <td>0.000011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>floor size^2</td>\n",
       "      <td>0.000001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>floor size year</td>\n",
       "      <td>0.000018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>floor size line</td>\n",
       "      <td>0.000136</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>floor year^2</td>\n",
       "      <td>0.000042</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>floor year line</td>\n",
       "      <td>-0.000333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>floor line^2</td>\n",
       "      <td>0.002611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>size^3</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>size^2 year</td>\n",
       "      <td>0.000001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>size^2 line</td>\n",
       "      <td>-0.000015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>size year^2</td>\n",
       "      <td>-0.000001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>size year line</td>\n",
       "      <td>-0.000127</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>size line^2</td>\n",
       "      <td>0.000594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>year^3</td>\n",
       "      <td>0.00001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>year^2 line</td>\n",
       "      <td>0.000269</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>year line^2</td>\n",
       "      <td>0.010473</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>line^3</td>\n",
       "      <td>-0.01794</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  0              1\n",
       "0                 1  495733.766447\n",
       "1             floor       0.041705\n",
       "2              size       0.003056\n",
       "3              year       0.352311\n",
       "4              line       2.790975\n",
       "5           floor^2       0.005104\n",
       "6        floor size      -0.000865\n",
       "7        floor year       0.001319\n",
       "8        floor line      -0.035902\n",
       "9            size^2       0.000023\n",
       "10        size year       0.000212\n",
       "11        size line      -0.001352\n",
       "12           year^2      -0.002009\n",
       "13        year line      -0.121726\n",
       "14           line^2      -0.103025\n",
       "15          floor^3      -0.000045\n",
       "16     floor^2 size      -0.000013\n",
       "17     floor^2 year      -0.000083\n",
       "18     floor^2 line       0.000011\n",
       "19     floor size^2       0.000001\n",
       "20  floor size year       0.000018\n",
       "21  floor size line       0.000136\n",
       "22     floor year^2       0.000042\n",
       "23  floor year line      -0.000333\n",
       "24     floor line^2       0.002611\n",
       "25           size^3            0.0\n",
       "26      size^2 year       0.000001\n",
       "27      size^2 line      -0.000015\n",
       "28      size year^2      -0.000001\n",
       "29   size year line      -0.000127\n",
       "30      size line^2       0.000594\n",
       "31           year^3        0.00001\n",
       "32      year^2 line       0.000269\n",
       "33      year line^2       0.010473\n",
       "34           line^3       -0.01794"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "coeff = pd.DataFrame([poly.get_feature_names_out(X.columns),lr1.coef_.tolist()]).T\n",
    "coeff"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "a305b0d0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 制表\n",
    "res=[]\n",
    "res.append(pd.DataFrame([poly.get_feature_names_out(X.columns),lr1.coef_.tolist()]).T)\n",
    "pd.concat(res).to_excel('平方单价至优参数.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "fef46e96",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.69428096])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pred=lr1.predict(X_s)\n",
    "pred"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "12393082",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([458.2254318])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pred*66*10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "c368a8cc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.00000e+00, 8.00000e+00, 6.60000e+01, 2.30000e+01, 4.00000e+00,\n",
       "        6.40000e+01, 5.28000e+02, 1.84000e+02, 3.20000e+01, 4.35600e+03,\n",
       "        1.51800e+03, 2.64000e+02, 5.29000e+02, 9.20000e+01, 1.60000e+01,\n",
       "        5.12000e+02, 4.22400e+03, 1.47200e+03, 2.56000e+02, 3.48480e+04,\n",
       "        1.21440e+04, 2.11200e+03, 4.23200e+03, 7.36000e+02, 1.28000e+02,\n",
       "        2.87496e+05, 1.00188e+05, 1.74240e+04, 3.49140e+04, 6.07200e+03,\n",
       "        1.05600e+03, 1.21670e+04, 2.11600e+03, 3.68000e+02, 6.40000e+01]])"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3127c804",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-495741.70035309927"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr1.intercept_ "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c20b70e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 4.95733766e+05,  4.17049478e-02,  3.05635113e-03,  3.52311178e-01,\n",
       "        2.79097513e+00,  5.10361095e-03, -8.64510024e-04,  1.31941140e-03,\n",
       "       -3.59024381e-02,  2.25247942e-05,  2.11670045e-04, -1.35204160e-03,\n",
       "       -2.00864087e-03, -1.21726153e-01, -1.03025087e-01, -4.49801765e-05,\n",
       "       -1.34572543e-05, -8.34947397e-05,  1.12069941e-05,  9.08740454e-07,\n",
       "        1.77288634e-05,  1.35532919e-04,  4.24953969e-05, -3.32952960e-04,\n",
       "        2.61118942e-03,  5.05614362e-08,  1.37282290e-06, -1.50614187e-05,\n",
       "       -1.12615074e-06, -1.26793652e-04,  5.93804609e-04,  1.01585711e-05,\n",
       "        2.69188290e-04,  1.04732613e-02, -1.79404436e-02])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr1.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "0c45274b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 4.95733766e+05,  3.33639582e-01,  2.01719175e-01,\n",
       "         8.10315710e+00,  1.11639005e+01,  3.26631101e-01,\n",
       "        -4.56461293e-01,  2.42771698e-01, -1.14887802e+00,\n",
       "         9.81180034e-02,  3.21315128e-01, -3.56938983e-01,\n",
       "        -1.06257102e+00, -1.11988061e+01, -1.64840139e+00,\n",
       "        -2.30298504e-02, -5.68434423e-02, -1.22904257e-01,\n",
       "         2.86899050e-03,  3.16677874e-02,  2.15299317e-01,\n",
       "         2.86245525e-01,  1.79840520e-01, -2.45053379e-01,\n",
       "         3.34232246e-01,  1.45362107e-02,  1.37540381e-01,\n",
       "        -2.62430160e-01, -3.93184269e-02, -7.69891058e-01,\n",
       "         6.27057667e-01,  1.23599335e-01,  5.69602422e-01,\n",
       "         3.85416016e+00, -1.14818839e+00]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_s*lr1.coef_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ccb33eaf",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
